# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
#   include emiconfig::wncondor9
class emiconfig::wncondor9 (
  $resource_group = "none"
  )
{
    yumrepo { "condor":
    baseurl => "http://${mirrorserver}/yum/condor/repo/23.0/el${operatingsystemmajrelease}/x86_64/release",
    descr => "condor",
    enabled => 1,
    gpgcheck => 0,
    priority => 20,
    before   => Yumrepo['site'],
  }

   $condor_pkg = [
        "condor",
        "python3-condor"
     ]

  package { $condor_pkg:
    ensure  => installed,
    require => Yumrepo['site'],
  } ->

  file {"/etc/condor/config.d/01-startd.conf":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/01-startd.conf",
    notify   => Exec['reconfig_condor']
  } ->

  file {"/etc/condor/config.d/02-startd-hard.conf":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    content    =>  template("${module_name}/02-startd-hard.erb"),
    #notify    => Exec['restart_condor']
    #notify     => Exec['reconfig_condor']
  } ->

  file { "/scratch/condor":
    ensure     =>  "directory",
    owner      =>  'condor',
    group      =>  'condor',
    mode       =>  '755'
  } ->

  service { 'condor':
    ensure     => 'running',
    enable     => true,
    hasrestart => true,
    hasstatus  => true,
  }

  exec {'restart_condor':
    command      => "/sbin/service condor restart",
    refreshonly  => true,
    require => Package["condor"],
  }

  exec {'reconfig_condor':
    command      => "/usr/sbin/condor_reconfig",
    refreshonly  => true,
    require => Package["condor"],
  }
}
